<?php

if (!defined('BASEPATH'))
     exit('No direct script access allowed');

if (!function_exists('sort_array_of_array')) {

     function sort_array_of_array(&$array, $subfield, $lowes_first = NULL) {
          $sortarray = array();
          foreach ($array as $key => $row) {
               $sortarray[$key] = $row[$subfield];
          }

          if (isset($lowes_first) && $lowes_first == TRUE) {
               array_multisort($sortarray, SORT_ASC, $array);
          } else {
               array_multisort($sortarray, SORT_DESC, $array);
          }
     }

}
?>
